package org.wxd.bi.test;

import io.netty.handler.codec.http.HttpHeaderNames;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wxd.net.NioFactory;
import org.wxd.net.ssl.SslProtocolType;
import org.wxd.net.web.hs.util.HttpPost;

import java.io.Serializable;

/**
 * @author: Troy.Chen(無心道, 15388152619)
 * @version: 2021-10-22 14:32
 **/
public class App implements Serializable {

    private static final long serialVersionUID = 1L;
    private static final Logger log = LoggerFactory.getLogger(App.class);

    @Test
    public void addAppInfo() throws Exception {
        /**
         * HkK43xK7
         * 注册一个游戏 服务器启动过后是空的，需要自己注册自己的游戏
         */
        String bodyString = HttpPost.of("https://127.0.0.1:18601/appinfo/addAppInfo")
                .setSslProtocolType(SslProtocolType.TLSV12)
                .addCookie(HttpHeaderNames.AUTHORIZATION, NioFactory.Default_Token)
                .addTextParam("appId", 1002)
                .addTextParam("appName", "御龙飞天1")
                .addTextParam("comment", "御龙飞天1")
                .request()
                .bodyString();
        log.debug(bodyString);
    }

    @Test
    public void loginCount() throws Exception {
        /**
         * 强制刷新一次登录统计
         */
        String bodyString = HttpPost.of("https://127.0.0.1:18601/query/loginCount")
                .setSslProtocolType(SslProtocolType.TLSV12)
                .addCookie(HttpHeaderNames.AUTHORIZATION, NioFactory.Default_Token)
                .request()
                .bodyString();
        log.debug(bodyString);
    }

}
